<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>详情</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<!-- jQuery-->
		<script type="text/javascript" src="/static/plugins/jquery/jquery-3.6.0.min.js"></script>

		<!-- layui-->
		<link rel="stylesheet" href="/static/plugins/layui/2.8.4/css/layui.css" media="all">
		<script src="/static/plugins/layui/2.8.4/layui.js" charset="utf-8"></script>
		
		
	</head>
	<style>
		.all-view{
			width: 90%;
			margin: 0 auto;
			margin-top: 20px;
		}
		.btn-view{
			margin-bottom: 10px;
			
		}
		.add-btn{
			width:120px;
		}
		.bottom-view{
			position: fixed;
			bottom: 0;
			width: 100%;
		}
		.add-btn-view{
			width: 260px;
			margin: 0 auto;
			margin-bottom: 40px;
		}
	</style>
	
	<body>
		
		<!--头部输入框-->
		
		<form class="layui-form layui-form-pane all-view" action="">


			<div class="layui-form-item layui-form-text" id="general-txt">
				<label class="layui-form-label">内容<i class="layui-icon layui-icon-question" id="backNum" style="color: #ffa33a;padding-left: 5px; cursor: pointer;" ></i></label>
				<div class="layui-input-block">
				  <textarea placeholder="请输入内容" class="layui-textarea" id="information" style="white-space: pre-line;height: 200px;" readonly></textarea>
					<div>字数：<span id="textCount">0</span></div>
				</div>
			  </div>

			<div style="margin-top: 30px;font-weight: bold;color: #ffa33a;font-size: 15px;margin-bottom: 10px;">原本的日志信息：</div>
			<div id="oldLogView" style="margin-bottom: 50px;">
				<div class="layui-form-item layui-form-text" id="oldQuestionView" style="margin-bottom: 10px;">
					<label class="layui-form-label">问题</label>
					<div class="layui-input-block" style="width: 98%;margin: 0 auto;">
						<span id="question" style="white-space: pre-line;font-size: 13px;color: #878787;"></span>
					</div>
				</div>
				<div class="layui-form-item layui-form-text" id="oldAnswerView" style="margin-bottom: 10px;">
					<label class="layui-form-label">回答</label>
					<div class="layui-input-block" style="width: 98%;margin: 0 auto;">
						<span id="answer" style="white-space: pre-line;font-size: 13px;color: #878787;"></span>
					</div>
				</div>
				<div class="layui-form-item layui-form-text" id="oldWholeSendMsgView" style="margin-bottom: 10px;">
					<label class="layui-form-label">完整信息</label>
					<div class="layui-input-block" style="width: 98%;margin: 0 auto;">
						<span id="wholeSendMsg" style="white-space: pre-line;font-size: 13px;color: #878787;"></span>
					</div>
				</div>
			</div>
			<div id="oldLogViewNo">
				<div style="text-align: center;margin-top: 20px;">原本日志已被删除</div>
			</div>


      </form>



		<input type="hidden" name="id" id="id" value=""><!--信息id-->
		<input type="hidden" name="oldLogId" id="oldLogId" value=""><!--旧日志id-->

      <script>
		  $('#id').val('[(${dto.id})]');
		  var tipIndex = null;
		  $("#backNum").mouseover(function() {
			  tipIndex = layer.tips("内容建议控制在300字以内，或者以中文感叹号（！，注意区分英文感叹号!）对输入的内容进行分段，每个段落300字以内。若无分段，则系统会自动以300个字数进行分段。", this, {tips: [2, "#C1C1C1"],time:0});
		  });
		  $("#backNum").mouseout(function() {layer.close(tipIndex);});

		  $.ajax({
			  url : '/api/inter/eKnowChatLogManage/eKnowChatLogManageDetail',
			  data : {id:$('#id').val()},
			  type : 'POST',
			  async : false,
			  success : function(result) {
				  if(result.code=='SUCCESS'){
					  var eKnowChatLogManage = result.eKnowChatLogManage;
					  if(eKnowChatLogManage!=null){
						  $('#information').val(eKnowChatLogManage.content);
						  $('#oldLogId').val(eKnowChatLogManage.oldLogId);
						  var information = document.getElementById('information');
						  $('#textCount').text(txtCount(information));
					  }
					  var eKnowChatLog = result.eKnowChatLog;
					  if(eKnowChatLog!=undefined && eKnowChatLog!=null){
						  $('#oldLogView').show();
						  $('#oldLogViewNo').hide();
						  $('#question').text(eKnowChatLog.question);
						  $('#answer').text(eKnowChatLog.answer);
						  if(eKnowChatLog.wholeSendMsg!=null && eKnowChatLog.wholeSendMsg!=''){
							  $('#wholeSendMsg').text(eKnowChatLog.wholeSendMsg);
							  $('#oldWholeSendMsgView').show();
						  }else {
							  $('#oldWholeSendMsgView').hide();
						  }

					  }else {
						  $('#oldLogView').hide();
						  $('#oldLogViewNo').show();
					  }
				  }else{
					  layer.msg('不好意思，系统出现问题了，请稍后重试！', {icon: 2});
					  setTimeout(function(){
						  window.parent.layer.closeAll();
					  }, 1000);
				  }
			  }
		  });

		  //var information = $('#information').val();
		  var information = document.getElementById('information');
		  $('#textCount').val(txtCount(information));



		  //输入框底下的字数变化监听
		  var el = document.getElementById('information');
		  el.addEventListener('input',function () {
			  var len =  txtCount(this); //   调用函数
			  document.getElementById('textCount').innerHTML = len;
		  });

		  //函数 - 获取文本内容和长度
		  function txtCount(el) {
			  var val = el.value;
			  var eLen = val.length;
			  return eLen;
		  }
      </script>

  </body>
</html>